package com.badlogic.androidgames;

import com.badlogic.androidgames.framework.Music;
import com.badlogic.androidgames.framework.Sound;
import com.badlogic.androidgames.framework.gl.Font;
import com.badlogic.androidgames.framework.gl.Texture;
import com.badlogic.androidgames.framework.gl.TextureRegion;
import com.badlogic.androidgames.framework.impl.GLGame;

public class Assets {
	public static Texture myButton;
    public static TextureRegion button;
	
    public static Texture myImageTextBox;
    public static TextureRegion imageTextBox;
    
    public static Texture myLine;
    public static TextureRegion line;
    
	public static Texture backgroundGS;    
    public static TextureRegion backgroundRegionGS;
    
    public static Texture backgroundMenu;    
    public static TextureRegion backgroundMenuRegion;
    
    public static Texture hud;    
    public static TextureRegion hudBG;
    
    public static Texture hudPerc;    
    public static TextureRegion hudPercBG;
    
    public static Texture items;        
        
    public static Font font;
    public static Texture fontTexture;        
    
    public static Font fontBlack;
    public static Texture fontTextureBlack;        

    public static TextureRegion mainMenu;
    
    
    
    public static Texture myLeftArrow;
    public static Texture myRightArrow;
    public static Texture myUpArrow;
    public static Texture myDownArrow;
    public static TextureRegion leftArrow;
    public static TextureRegion rightArrow;
    public static TextureRegion upArrow;
    public static TextureRegion downArrow;
    
    public static Texture login;
    public static TextureRegion loginRegion;
    public static Texture logout;
    public static TextureRegion logoutRegion;
    public static Texture playGame;
    public static TextureRegion playGameRegion;
    public static Texture playGameFree;
    public static TextureRegion playGameFreeRegion;
    public static Texture difficultGame;
    public static TextureRegion difficultGameRegion;    
    
    public static Texture facebookTexture;
    public static TextureRegion facebookImage;
    
    
    public static Texture myTwLogo;
    public static TextureRegion twLogo;
    public static Texture myYtLogo;
    public static TextureRegion ytLogo;
    public static Texture myFlLogo;
    public static TextureRegion flLogo;

    
    public static Texture brainTexture;
    public static TextureRegion brain[];
    
    public static Texture levelCompletedBGTexture;
    public static TextureRegion levelCompletedBG;
    public static Texture levelCompletedBGTexture_2;
    public static TextureRegion levelCompletedBG_2;
    
    public static Music music;
    public static Sound jumpSound;
    
    public static void load(GLGame game) {
    	myButton = new Texture(game, "myTexture_2.png");
        button = new TextureRegion(myButton,0,0,200,65);
        
        myImageTextBox = new Texture(game, "imageTextBox_2.png");
        imageTextBox = new TextureRegion(myImageTextBox,0,0,200,268);
    	
        myLine = new Texture(game, "linea.png");
        line = new TextureRegion(myLine,0,0,2,10);
        
        backgroundGS = new Texture(game, "bg_2.png");
        backgroundRegionGS = new TextureRegion(backgroundGS, 0, 0, 1024, 1024);
        
        backgroundMenu = new Texture(game, "bgMenu.png");
        backgroundMenuRegion = new TextureRegion(backgroundMenu, 0, 0, 480, 800);
        
        items = new Texture(game, "items.png");        
        //font = new Font(items, 224, 0, 16, 16, 20);
        mainMenu = new TextureRegion(items, 0, 224, 300, 110);
        
        login = new Texture(game, "login.png");        
        loginRegion = new TextureRegion(login, 0, 0, 184, 34);
        logout = new Texture(game, "logout.png");        
        logoutRegion = new TextureRegion(logout, 0, 0, 184, 34);        
        playGame = new Texture(game, "playGame.png");        
        playGameRegion = new TextureRegion(playGame, 0, 0, 184, 34);
        playGameFree = new Texture(game, "freeMode.png");        
        playGameFreeRegion = new TextureRegion(playGameFree, 0, 0, 300, 34);
        difficultGame = new Texture(game, "difficult.png");        
        difficultGameRegion = new TextureRegion(difficultGame, 0, 0, 250, 34);
        
        fontTexture = new Texture(game, "ExportedFont_3.png");        
        font = new Font(fontTexture, 0, 0, 16, 16, 20);
        
        fontTextureBlack = new Texture(game, "ExportedFont_3_black.png");        
        fontBlack = new Font(fontTextureBlack, 0, 0, 16, 16, 20);
        
        
        hud = new Texture(game, "hudBG.png");
        hudBG = new TextureRegion(hud, 0, 0, 2, 40);
        
        hudPerc = new Texture(game, "hudPercBG.png");
        hudPercBG = new TextureRegion(hudPerc, 0, 0, 20, 1);
        //items = new Texture(game, "items.png");        
        
        
        
        myLeftArrow = new Texture(game, "leftArrow.png");
        leftArrow = new TextureRegion(myLeftArrow, 0, 0, 44, 44);
        
        myRightArrow = new Texture(game, "rightArrow.png");
        rightArrow = new TextureRegion(myRightArrow, 0, 0, 44, 44);
        
        myUpArrow = new Texture(game, "upArrow.png");
        upArrow = new TextureRegion(myUpArrow, 0, 0, 44, 44);
        
        myDownArrow = new Texture(game, "downArrow.png");
        downArrow = new TextureRegion(myDownArrow, 0, 0, 44, 44);
        
        
        myFlLogo = new Texture(game, "flLogo.png");
        flLogo = new TextureRegion(myFlLogo, 0, 0, 50, 50);
        myYtLogo = new Texture(game, "ytLogo.png");
        ytLogo = new TextureRegion(myYtLogo, 0, 0, 50, 50);
        myTwLogo = new Texture(game, "twLogo.png");
        twLogo = new TextureRegion(myTwLogo, 0, 0, 50, 50);
        //facebookImage1 = new TextureRegion(items, 0, 224, 300, 110);
        //facebookImage2 = null;
        
        brainTexture = new Texture(game, "play-menu-spritesheet.png");
        brain = new TextureRegion[11];
        brain[2] = new TextureRegion(brainTexture, 0, 0,    50, 32);
        brain[3] = new TextureRegion(brainTexture, 0, 32,   50, 32);
        brain[4] = new TextureRegion(brainTexture, 0, 32*2, 50, 32);
        brain[8] = new TextureRegion(brainTexture, 0, 32*3, 50, 32);
        brain[10]= new TextureRegion(brainTexture, 0, 32*4, 50, 32);
        brain[0] = new TextureRegion(brainTexture, 0, 32*5, 50, 32);
        
        brain[1] = new TextureRegion(brainTexture, 50, 0,    50, 32);
        brain[9] = new TextureRegion(brainTexture, 50, 32,   50, 32);
        brain[7] = new TextureRegion(brainTexture, 50, 32*2, 50, 32);
        brain[6] = new TextureRegion(brainTexture, 50, 32*2, 50, 32);
        brain[5] = new TextureRegion(brainTexture, 50, 32*2, 50, 32);
        
        
        levelCompletedBGTexture = new Texture(game, "livello_completato_bg.png");
        levelCompletedBG = new TextureRegion(levelCompletedBGTexture, 0, 0, 480, 800);
        levelCompletedBGTexture_2 = new Texture(game, "livello_completato_bg_2.png");
        levelCompletedBG_2 = new TextureRegion(levelCompletedBGTexture_2, 0, 0, 480, 800);
        
        music = game.getAudio().newMusic("music.mp3");
        music.setLooping(true);
        music.setVolume(0.5f);
        if(Settings.soundEnabled)
            music.play();
        jumpSound = game.getAudio().newSound("jump.ogg");       
            
    }       
    
    public static void reload() 
    {
        backgroundGS.reload();
        backgroundMenu.reload();
        items.reload();
        myButton.reload();
        myImageTextBox.reload();
        myLine.reload();
        fontTexture.reload();
        fontTextureBlack.reload();
        hud.reload();
        hudPerc.reload();
        myLeftArrow.reload();
        myRightArrow.reload();
        myUpArrow.reload();
        myDownArrow.reload();
        myFlLogo.reload();
        myYtLogo.reload();
        myTwLogo.reload();
        login.reload();
        logout.reload();
        playGame.reload();
        playGameFree.reload();
        difficultGame.reload();
        brainTexture.reload();
        levelCompletedBGTexture.reload();
        levelCompletedBGTexture_2.reload();
        
        if(Settings.soundEnabled)
            music.play();
    }
    
    public static void playSound(Sound sound) {
        if(Settings.soundEnabled)
            sound.play(1);
    }
}
